//
//  BaseViewController.m
//  lanrenzhoumo
//
//  Created by 谢叶茂 on 16/4/16.
//  Copyright © 2016年 吕嘉麟. All rights reserved.
//

#import "BaseViewController.h"
#import "Define.h"
@interface BaseViewController ()

@end

@implementation BaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15],NSForegroundColorAttributeName:Color_RGB(76, 79, 80, 1)}];
    [self setAutomaticallyAdjustsScrollViewInsets:NO];
    self.showCatBtn=NO;
    self.showNewBackBtn=NO;
    
    UIViewController *topVC=[[self.navigationController viewControllers]firstObject];
    if (self==topVC) {
        [self setShowCatBtn:YES];
        [self setShowNewBackBtn:YES];
        
    }
    else{
        [self setShowCatBtn:NO];
        [self setShowNewBackBtn:NO];
    }
}
#pragma mark--是否切换返回按钮图片
-(void)setIsChangeBackBtnImage:(BOOL)setIsChangeBackImage{
    
}
#pragma mark--是否展示猫按钮
- (void)setShowCatBtn:(BOOL)showCatBtn{
    if (showCatBtn) {
        UIButton *catBtn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 25, 26)];
        [catBtn setBackgroundImage:[UIImage imageNamed:@"cat_me.png"] forState:UIControlStateNormal];
        [catBtn addTarget:self action:@selector(catBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *catBarItem=[[UIBarButtonItem alloc]initWithCustomView:catBtn];
        self.navigationItem.leftBarButtonItem=catBarItem;
    }
    else{
        self.navigationItem.leftBarButtonItem=nil;
    }
}
#pragma mark--是否展示自定义返回按钮
-(void)setShowNewBackBtn:(BOOL)showNewBackBtn{
    if (showNewBackBtn) {
        UIButton *backBtn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];
        [backBtn setBackgroundImage:[UIImage imageNamed:@"ic_nav_left.png"] forState:UIControlStateNormal];
        [backBtn addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
        UIBarButtonItem *backBarItem=[[UIBarButtonItem alloc]initWithCustomView:backBtn];
        self.navigationItem.leftBarButtonItem=backBarItem;
    }
}
#pragma mark--猫按钮响应事件
- (void)catBtnAction:(UIButton *)catBtn{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
